package com.powerhua.cms.persistence.dao.ibatis;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.powerhua.cms.domain.Content;
import com.powerhua.cms.persistence.dao.ContentDao;

public class ContentDaoImpl extends SqlMapClientDaoSupport implements
        ContentDao {

    @Override
    public void create(Content c) throws DataAccessException {
    }

    @Override
    public void deleteById(String id) throws DataAccessException {
    }

    @Override
    public Content getContentById(String id) throws DataAccessException {
        Content c = (Content) getSqlMapClientTemplate().queryForObject("getContentById", id);
        return c;
    }

    @Override
    public void update(Content c) throws DataAccessException {
    }

    @Override
    public List getContentsByUserId(String userId) throws DataAccessException {
        List list = getSqlMapClientTemplate().queryForList(
                "getAllContentsByUserId", userId);
        return list;
    }

    @Override
    public List getContentsByCategoryId(String categoryId, String userId) {
        List list = getSqlMapClientTemplate().queryForList(
                "getAllContentsByUserId", userId);
        return list;
    }
}
